package com.sjms._10_结构_组合模式;

/**
 * 文件
 */
public class File extends ANode {

    public File(String name, String path, int level) {
        super(name, path, level);
    }

    @Override
    void add(ANode obj) {
        throw new RuntimeException("文件节点不支持添加操作");
    }

    @Override
    void remove(int index) {
        throw new RuntimeException("文件节点不支持删除操作");
    }

    @Override
    void print() {
        //输出层级
        for (int j = 0; j < level; j++) {
            System.out.print("    ");
        }

        System.out.println("~文件名" + this.name + " 路径：" + this.path);
    }

}
